package cn.yumei.lifepay.business.imp;

import javax.annotation.Resource;

import net.sf.json.JSONObject;

import org.springframework.stereotype.Service;

import cn.yumei.lifepay.business.EbppService;
import cn.yumei.lifepay.manager.EbppManager;
import cn.yumei.lifepay.util.Global;


@Service
public class EbppServiceImp implements EbppService{
	
	@Resource
	private EbppManager ebppManager;
	
	private String result = "";
	private JSONObject jsonObject = null;

	@Override
	public String getBill(JSONObject searchCondition) {
		result = "";
		jsonObject = ebppManager.getBill(searchCondition);
		if(jsonObject != null){
			result = jsonObject.toString();
		}
		return result;
	}

	@Override
	public String createBillOrder(JSONObject orderInfo) {
		result = "";
		jsonObject = ebppManager.createBillOrder(orderInfo);
		if(jsonObject != null){
			result = jsonObject.toString();
		}
		return result;
	}

	@Override
	public String getCity(JSONObject searchCondition) {
		result = "";
		jsonObject = ebppManager.getCity(searchCondition);
		if(jsonObject != null){
			result = jsonObject.toString();
		}
		return result;
	}

	@Override
	public String getCompanyFare(JSONObject searchCondition) {
		result = "";
		jsonObject = ebppManager.getCompanyFare(searchCondition);
		if(jsonObject != null){
			result = jsonObject.toString();
		}
		return result;
	}

	@Override
	public String getCompany(JSONObject searchCondition) {
		result = "";
		jsonObject = ebppManager.getCompany(searchCondition);
		if(jsonObject != null){
			result = jsonObject.toString();
		}
		return result;
	}

	@Override
	public String getProvince(JSONObject searchCondition) {
		result = "";
		Global.access_token = searchCondition.getString("access_token");
		jsonObject = ebppManager.getProvince(searchCondition);
		if(jsonObject != null){
			result = jsonObject.toString();
		}
		return result;
	}
	
}
